<!--conf
<sample in_favorites="false">
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Date/Decimal format</title>
	
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	
</head>
<body>
	
	<h1>Date/Decimal format</h1>
	<p>
        You have possibility to edit data in columns of the grid. Try to edit Calendar and Numeric fields:</p>
		
	<div id="gridbox" style="width:400px;height:210px;background-color:white;"></div>
		
	Format of the first column: 
    <input id='a01' value='$0,000'><input type='button' value='Update' onclick='doItOnce(this.previousSibling.value,0)'><br/>
    Format of the second column: 
    <input id='a01' value='@000.00Zbh'><input type='button' value='Update' onclick='doItOnce(this.previousSibling.value,1)'><br/>
    Format of the third column (d,m,y): 
    <input id='a01' value='%Y-%d/%m'><input type='button' value='Update' onclick='doItOnce(this.previousSibling.value,2)'>
    <script>
    	var prev_format = "%d/%m-%Y";
        function doItOnce(a,b){
            var z=mygrid.serialize();
            mygrid.clearAll();
            if (b!=2){
                mygrid.setNumberFormat(a,b);
                mygrid.setDateFormat(prev_format,prev_format);
            }else{
                mygrid.setDateFormat(a,prev_format);
                prev_format=a;
            }

            mygrid.loadXMLString(z);
            }
    </script>
<br>


<script>
	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setHeader("N.format,N.format,Date format");
	mygrid.setInitWidths("100,100,200")
	mygrid.setColAlign("right,left,center")
	mygrid.setColTypes("edn,edn,dhxCalendar");
    mygrid.setDateFormat("%d/%m-%Y");
    mygrid.setNumberFormat("$0,000",0);
    mygrid.setNumberFormat("@000.00Zbh",1);
	mygrid.setColSorting("int,int,date")
	mygrid.init();
	mygrid.setSkin("dhx_skyblue")
	mygrid.loadXML("../common/grid_formatting.xml");
</script>

</body>
</html>
